package com.ruoyi;

import com.ruoyi.framework.config.GetSocketInfoThread;
import com.ruoyi.project.system.coordinates.mapper.TbCoordinatesMapper;
import com.sun.jna.Library;
import com.sun.jna.Native;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import java.io.IOException;

/**
 * 启动程序
 * 
 * @author kj
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{

    @Autowired
    private static  TbCoordinatesMapper tbCoordinatesMapper;
    public interface DllUtil extends Library{
        /**
         *
         */
        RuoYiApplication.DllUtil INSTANCE = (RuoYiApplication.DllUtil) Native.loadLibrary("LMS_Interface", RuoYiApplication.DllUtil.class);


        /**
         * 函数初始化
         * @param unsigned 设备号
         * @param lmsIpAddr lms ip
         * @param lmsPort 端口
         * @param controlSysIPAddr 云台 ip
         * @param controlSysPort 端口
         * @param dUserAngleOffsetToCordXAxis
         * @param iDistanceOffsetToRotateCenter
         * @param angOffsetToHorizontal
         * @return
         */
        int LMS_Init(
                int unsigned,
                String  lmsIpAddr,
                int lmsPort,
                String  controlSysIPAddr,
                int controlSysPort,
                double dUserAngleOffsetToCordXAxis,
                double iDistanceOffsetToRotateCenter,
                double angOffsetToHorizontal);
    }
    public static void main(String[] args) throws IOException {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);
        System.out.println("(♥◠‿◠)ﾉﾞ  启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");
        /**
         * 设备初始化
         */
        int bo = RuoYiApplication.DllUtil.INSTANCE.LMS_Init(1,"192.168.0.37",2112,
                "192.168.0.30",5000,0.0,0.66,0.0);

        System.out.println("LMS_Init()="+bo);
        GetSocketInfoThread thread = new GetSocketInfoThread();
        thread.start();
    }

}